package cn.knight.productfeign;

import cn.knight.domain.Store;
import cn.knight.utils.Result;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;

@Component
public class ProductFallback implements FallbackFactory<ProductFeignClient> {


    @Override
    public ProductFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
        return new ProductFeignClient() {
            @Override
            public Result save(@RequestBody Store store) {
                return new Result().setSuccess(false).setMessage("降级方法！");
            }
        };
    }
}
